<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QAbstractScrollArea Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QAbstractScrollArea Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QAbstractScrollArea widget provides a scrolling area with
on-demand scroll bars. <a href="#details">More...</a></p>

<p>Inherits <a href="qframe.html">QFrame</a>.</p><p>Inherited by <a href="qabstractitemview.html">QAbstractItemView</a>, <a href="qgraphicsview.html">QGraphicsView</a>, <a href="qmdiarea.html">QMdiArea</a>, <a href="qplaintextedit.html">QPlainTextEdit</a>, <a href="qscrollarea.html">QScrollArea</a> and <a href="qtextedit.html">QTextEdit</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qabstractscrollarea.html#QAbstractScrollArea">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#addScrollBarWidget">addScrollBarWidget</a></b> (<i>self</i>, QWidget&#160;<i>widget</i>, Qt.Alignment&#160;<i>alignment</i>)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#contextMenuEvent">contextMenuEvent</a></b> (<i>self</i>, QContextMenuEvent)</li><li><div class="fn" />QWidget <b><a href="qabstractscrollarea.html#cornerWidget">cornerWidget</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#dragEnterEvent">dragEnterEvent</a></b> (<i>self</i>, QDragEnterEvent)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#dragLeaveEvent">dragLeaveEvent</a></b> (<i>self</i>, QDragLeaveEvent)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#dragMoveEvent">dragMoveEvent</a></b> (<i>self</i>, QDragMoveEvent)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#dropEvent">dropEvent</a></b> (<i>self</i>, QDropEvent)</li><li><div class="fn" />bool <b><a href="qabstractscrollarea.html#event">event</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" />QScrollBar <b><a href="qabstractscrollarea.html#horizontalScrollBar">horizontalScrollBar</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.ScrollBarPolicy <b><a href="qabstractscrollarea.html#horizontalScrollBarPolicy">horizontalScrollBarPolicy</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#keyPressEvent">keyPressEvent</a></b> (<i>self</i>, QKeyEvent)</li><li><div class="fn" />QSize <b><a href="qabstractscrollarea.html#maximumViewportSize">maximumViewportSize</a></b> (<i>self</i>)</li><li><div class="fn" />QSize <b><a href="qabstractscrollarea.html#minimumSizeHint">minimumSizeHint</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#mouseDoubleClickEvent">mouseDoubleClickEvent</a></b> (<i>self</i>, QMouseEvent)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#mouseMoveEvent">mouseMoveEvent</a></b> (<i>self</i>, QMouseEvent)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#mousePressEvent">mousePressEvent</a></b> (<i>self</i>, QMouseEvent)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#mouseReleaseEvent">mouseReleaseEvent</a></b> (<i>self</i>, QMouseEvent)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#paintEvent">paintEvent</a></b> (<i>self</i>, QPaintEvent)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#resizeEvent">resizeEvent</a></b> (<i>self</i>, QResizeEvent)</li><li><div class="fn" />list-of-QWidget <b><a href="qabstractscrollarea.html#scrollBarWidgets">scrollBarWidgets</a></b> (<i>self</i>, Qt.Alignment&#160;<i>alignment</i>)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#scrollContentsBy">scrollContentsBy</a></b> (<i>self</i>, int&#160;<i>dx</i>, int&#160;<i>dy</i>)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#setCornerWidget">setCornerWidget</a></b> (<i>self</i>, QWidget&#160;<i>widget</i>)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#setHorizontalScrollBar">setHorizontalScrollBar</a></b> (<i>self</i>, QScrollBar&#160;<i>scrollbar</i>)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#setHorizontalScrollBarPolicy">setHorizontalScrollBarPolicy</a></b> (<i>self</i>, Qt.ScrollBarPolicy)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#setupViewport">setupViewport</a></b> (<i>self</i>, QWidget&#160;<i>viewport</i>)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#setVerticalScrollBar">setVerticalScrollBar</a></b> (<i>self</i>, QScrollBar&#160;<i>scrollbar</i>)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#setVerticalScrollBarPolicy">setVerticalScrollBarPolicy</a></b> (<i>self</i>, Qt.ScrollBarPolicy)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#setViewport">setViewport</a></b> (<i>self</i>, QWidget&#160;<i>widget</i>)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#setViewportMargins">setViewportMargins</a></b> (<i>self</i>, int&#160;<i>left</i>, int&#160;<i>top</i>, int&#160;<i>right</i>, int&#160;<i>bottom</i>)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#setViewportMargins-2">setViewportMargins</a></b> (<i>self</i>, QMargins&#160;<i>margins</i>)</li><li><div class="fn" />QSize <b><a href="qabstractscrollarea.html#sizeHint">sizeHint</a></b> (<i>self</i>)</li><li><div class="fn" />QScrollBar <b><a href="qabstractscrollarea.html#verticalScrollBar">verticalScrollBar</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.ScrollBarPolicy <b><a href="qabstractscrollarea.html#verticalScrollBarPolicy">verticalScrollBarPolicy</a></b> (<i>self</i>)</li><li><div class="fn" />QWidget <b><a href="qabstractscrollarea.html#viewport">viewport</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qabstractscrollarea.html#viewportEvent">viewportEvent</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" /><b><a href="qabstractscrollarea.html#wheelEvent">wheelEvent</a></b> (<i>self</i>, QWheelEvent)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QAbstractScrollArea widget provides a scrolling area with
on-demand scroll bars.</p>
<p>QAbstractScrollArea is a low-level abstraction of a scrolling
area. The area provides a central widget called the viewport, in
which the contents of the area is to be scrolled (i.e, the visible
parts of the contents are rendered in the viewport).</p>
<p>Next to the viewport is a vertical scroll bar, and below is a
horizontal scroll bar. When all of the area contents fits in the
viewport, each scroll bar can be either visible or hidden depending
on the scroll bar's <a href="qt.html#ScrollBarPolicy-enum">Qt.ScrollBarPolicy</a>. When a
scroll bar is hidden, the viewport expands in order to cover all
available space. When a scroll bar becomes visible again, the
viewport shrinks in order to make room for the scroll bar.</p>
<p>It is possible to reserve a margin area around the viewport, see
<a href="qabstractscrollarea.html#setViewportMargins">setViewportMargins</a>().
The feature is mostly used to place a <a href="qheaderview.html">QHeaderView</a> widget above or beside the
scrolling area. Subclasses of QAbstractScrollArea should implement
margins.</p>
<p>When inheriting QAbstractScrollArea, you need to do the
following:</p>
<ul>
<li>Control the scroll bars by setting their range, value, page
step, and tracking their movements.</li>
<li>Draw the contents of the area in the viewport according to the
values of the scroll bars.</li>
<li>Handle events received by the viewport in <a href="qabstractscrollarea.html#viewportEvent">viewportEvent</a>() -
notably resize events.</li>
<li>Use <tt>viewport-&gt;update()</tt> to update the contents of
the viewport instead of <a href="qwidget.html#update">update()</a>
as all painting operations take place on the viewport.</li>
</ul>
<p>With a scroll bar policy of <a href="qt.html#ScrollBarPolicy-enum">Qt.ScrollBarAsNeeded</a> (the
default), QAbstractScrollArea shows scroll bars when they provide a
non-zero scrolling range, and hides them otherwise.</p>
<p>The scroll bars and viewport should be updated whenever the
viewport receives a resize event or the size of the contents
changes. The viewport also needs to be updated when the scroll bars
values change. The initial values of the scroll bars are often set
when the area receives new contents.</p>
<p>We give a simple example, in which we have implemented a scroll
area that can scroll any <a href="qwidget.html">QWidget</a>. We
make the widget a child of the viewport; this way, we do not have
to calculate which part of the widget to draw but can simply move
the widget with <a href="qwidget.html#pos-prop">QWidget.move</a>(). When the area contents
or the viewport size changes, we do the following:</p>
<pre class="cpp">
     <span class="type"><a href="qsize.html">QSize</a></span> areaSize <span class="operator">=</span> viewport()<span class="operator">-</span><span class="operator">&gt;</span>size();
     <span class="type"><a href="qsize.html">QSize</a></span>  widgetSize <span class="operator">=</span> widget<span class="operator">-</span><span class="operator">&gt;</span>size();

     verticalScrollBar()<span class="operator">-</span><span class="operator">&gt;</span>setPageStep(areaSize<span class="operator">.</span>height());
     horizontalScrollBar()<span class="operator">-</span><span class="operator">&gt;</span>setPageStep(areaSize<span class="operator">.</span>width());
     verticalScrollBar()<span class="operator">-</span><span class="operator">&gt;</span>setRange(<span class="number">0</span><span class="operator">,</span> widgetSize<span class="operator">.</span>height() <span class="operator">-</span> areaSize<span class="operator">.</span>height());
     horizontalScrollBar()<span class="operator">-</span><span class="operator">&gt;</span>setRange(<span class="number">0</span><span class="operator">,</span> widgetSize<span class="operator">.</span>width() <span class="operator">-</span> areaSize<span class="operator">.</span>width());
     updateWidgetPosition();
</pre>
<p>When the scroll bars change value, we need to update the widget
position, i.e., find the part of the widget that is to be drawn in
the viewport:</p>
<pre class="cpp">
     <span class="type">int</span> hvalue <span class="operator">=</span> horizontalScrollBar()<span class="operator">-</span><span class="operator">&gt;</span>value();
     <span class="type">int</span> vvalue <span class="operator">=</span> verticalScrollBar()<span class="operator">-</span><span class="operator">&gt;</span>value();
     <span class="type"><a href="qpoint.html">QPoint</a></span> topLeft <span class="operator">=</span> viewport()<span class="operator">-</span><span class="operator">&gt;</span>rect()<span class="operator">.</span>topLeft();

     widget<span class="operator">-</span><span class="operator">&gt;</span>move(topLeft<span class="operator">.</span>x() <span class="operator">-</span> hvalue<span class="operator">,</span> topLeft<span class="operator">.</span>y() <span class="operator">-</span> vvalue);
</pre>
<p>In order to track scroll bar movements, reimplement the virtual
function <a href="qabstractscrollarea.html#scrollContentsBy">scrollContentsBy</a>().
In order to fine-tune scrolling behavior, connect to a scroll bar's
<a href="qabstractslider.html#actionTriggered">QAbstractSlider.actionTriggered</a>()
signal and adjust the <a href="qabstractslider.html#sliderPosition-prop">QAbstractSlider.sliderPosition</a>
as you wish.</p>
<p>For convenience, QAbstractScrollArea makes all viewport events
available in the virtual <a href="qabstractscrollarea.html#viewportEvent">viewportEvent</a>()
handler. <a href="qwidget.html">QWidget</a>'s specialized handlers
are remapped to viewport events in the cases where this makes
sense. The remapped specialized handlers are: <a href="qabstractscrollarea.html#paintEvent">paintEvent</a>(), <a href="qabstractscrollarea.html#mousePressEvent">mousePressEvent</a>(),
<a href="qabstractscrollarea.html#mouseReleaseEvent">mouseReleaseEvent</a>(),
<a href="qabstractscrollarea.html#mouseDoubleClickEvent">mouseDoubleClickEvent</a>(),
<a href="qabstractscrollarea.html#mouseMoveEvent">mouseMoveEvent</a>(),
<a href="qabstractscrollarea.html#wheelEvent">wheelEvent</a>(),
<a href="qabstractscrollarea.html#dragEnterEvent">dragEnterEvent</a>(),
<a href="qabstractscrollarea.html#dragMoveEvent">dragMoveEvent</a>(),
<a href="qabstractscrollarea.html#dragLeaveEvent">dragLeaveEvent</a>(),
<a href="qabstractscrollarea.html#dropEvent">dropEvent</a>(),
<a href="qabstractscrollarea.html#contextMenuEvent">contextMenuEvent</a>(),
and <a href="qabstractscrollarea.html#resizeEvent">resizeEvent</a>().</p>
<p><a href="qscrollarea.html">QScrollArea</a>, which inherits
QAbstractScrollArea, provides smooth scrolling for any <a href="qwidget.html">QWidget</a> (i.e., the widget is scrolled pixel by
pixel). You only need to subclass QAbstractScrollArea if you need
more specialized behavior. This is, for instance, true if the
entire contents of the area is not suitable for being drawn on a
<a href="qwidget.html">QWidget</a> or if you do not want smooth
scrolling.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QAbstractScrollArea" />QAbstractScrollArea.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a viewport.</p>
<p>The <i>parent</i> argument is sent to the <a href="qwidget.html">QWidget</a> constructor.</p>


<h3 class="fn"><a name="addScrollBarWidget" />QAbstractScrollArea.addScrollBarWidget (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, <a href="qt-alignment.html">Qt.Alignment</a>&#160;<i>alignment</i>)</h3><p>The <i>widget</i> argument has it's ownership transferred to Qt.</p><p>Adds <i>widget</i> as a scroll bar widget in the location
specified by <i>alignment</i>.</p>
<p>Scroll bar widgets are shown next to the horizontal or vertical
scroll bar, and can be placed on either side of it. If you want the
scroll bar widgets to be always visible, set the scrollBarPolicy
for the corresponding scroll bar to <tt>AlwaysOn</tt>.</p>
<p><i>alignment</i> must be one of Qt.Alignleft and <a href="qt.html#AlignmentFlag-enum">Qt.AlignRight</a>, which maps to the
horizontal scroll bar, or <a href="qt.html#AlignmentFlag-enum">Qt.AlignTop</a> and <a href="qt.html#AlignmentFlag-enum">Qt.AlignBottom</a>, which maps to the
vertical scroll bar.</p>
<p>A scroll bar widget can be removed by either re-parenting the
widget or deleting it. It's also possible to hide a widget with
<a href="qwidget.html#hide">QWidget.hide</a>()</p>
<p>The scroll bar widget will be resized to fit the scroll bar
geometry for the current style. The following describes the case
for scroll bar widgets on the horizontal scroll bar:</p>
<p>The height of the widget will be set to match the height of the
scroll bar. To control the width of the widget, use
QWidget.setMinimumWidth and QWidget.setMaximumWidth, or implement
<a href="qwidget.html#sizeHint-prop">QWidget.sizeHint</a>() and
set a horizontal size policy. If you want a square widget, call
QStyle.pixelMetric(<a href="qstyle.html#PixelMetric-enum">QStyle.PM_ScrollBarExtent</a>) and
set the width to this value.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qabstractscrollarea.html#scrollBarWidgets">scrollBarWidgets</a>().</p>


<h3 class="fn"><a name="contextMenuEvent" />QAbstractScrollArea.contextMenuEvent (<i>self</i>, <a href="qcontextmenuevent.html">QContextMenuEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#contextMenuEvent">QWidget.contextMenuEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive
context menu events for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget. The
event is passed in <i>e</i>.</p>
<p><b>See also</b> <a href="qwidget.html#contextMenuEvent">QWidget.contextMenuEvent</a>().</p>


<h3 class="fn"><a name="cornerWidget" /><a href="qwidget.html">QWidget</a> QAbstractScrollArea.cornerWidget (<i>self</i>)</h3><p>Returns the widget in the corner between the two scroll
bars.</p>
<p>By default, no corner widget is present.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qabstractscrollarea.html#setCornerWidget">setCornerWidget</a>().</p>


<h3 class="fn"><a name="dragEnterEvent" />QAbstractScrollArea.dragEnterEvent (<i>self</i>, <a href="qdragenterevent.html">QDragEnterEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#dragEnterEvent">QWidget.dragEnterEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive
drag enter events (passed in <i>event</i>), for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget.</p>
<p><b>See also</b> <a href="qwidget.html#dragEnterEvent">QWidget.dragEnterEvent</a>().</p>


<h3 class="fn"><a name="dragLeaveEvent" />QAbstractScrollArea.dragLeaveEvent (<i>self</i>, <a href="qdragleaveevent.html">QDragLeaveEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#dragLeaveEvent">QWidget.dragLeaveEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive
drag leave events (passed in <i>event</i>), for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget.</p>
<p><b>See also</b> <a href="qwidget.html#dragLeaveEvent">QWidget.dragLeaveEvent</a>().</p>


<h3 class="fn"><a name="dragMoveEvent" />QAbstractScrollArea.dragMoveEvent (<i>self</i>, <a href="qdragmoveevent.html">QDragMoveEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#dragMoveEvent">QWidget.dragMoveEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive
drag move events (passed in <i>event</i>), for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget.</p>
<p><b>See also</b> <a href="qwidget.html#dragMoveEvent">QWidget.dragMoveEvent</a>().</p>


<h3 class="fn"><a name="dropEvent" />QAbstractScrollArea.dropEvent (<i>self</i>, <a href="qdropevent.html">QDropEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#dropEvent">QWidget.dropEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive
drop events (passed in <i>event</i>), for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget.</p>
<p><b>See also</b> <a href="qwidget.html#dropEvent">QWidget.dropEvent</a>().</p>


<h3 class="fn"><a name="event" />bool QAbstractScrollArea.event (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p>
<p>This is the main event handler for the <a href="qabstractscrollarea.html">QAbstractScrollArea</a> widget
(<i>not</i> the scrolling area <a href="qabstractscrollarea.html#viewport">viewport</a>()). The specified
<i>event</i> is a general event object that may need to be cast to
the appropriate class depending on its type.</p>
<p><b>See also</b> <a href="qevent.html#type">QEvent.type</a>().</p>


<h3 class="fn"><a name="horizontalScrollBar" /><a href="qscrollbar.html">QScrollBar</a> QAbstractScrollArea.horizontalScrollBar (<i>self</i>)</h3><p>Returns the horizontal scroll bar.</p>
<p><b>See also</b> <a href="qabstractscrollarea.html#setHorizontalScrollBar">setHorizontalScrollBar</a>(),
<a href="qabstractscrollarea.html#horizontalScrollBarPolicy-prop">horizontalScrollBarPolicy</a>,
and <a href="qabstractscrollarea.html#verticalScrollBar">verticalScrollBar</a>().</p>


<h3 class="fn"><a name="horizontalScrollBarPolicy" /><a href="qt.html#ScrollBarPolicy-enum">Qt.ScrollBarPolicy</a> QAbstractScrollArea.horizontalScrollBarPolicy (<i>self</i>)</h3><h3 class="fn"><a name="keyPressEvent" />QAbstractScrollArea.keyPressEvent (<i>self</i>, <a href="qkeyevent.html">QKeyEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#keyPressEvent">QWidget.keyPressEvent</a>().</p>
<p>This function is called with key event <i>e</i> when key presses
occur. It handles PageUp, PageDown, Up, Down, Left, and Right, and
ignores all other key presses.</p>


<h3 class="fn"><a name="maximumViewportSize" /><a href="qsize.html">QSize</a> QAbstractScrollArea.maximumViewportSize (<i>self</i>)</h3><p>Returns the size of the viewport as if the scroll bars had no
valid scrolling range.</p>


<h3 class="fn"><a name="minimumSizeHint" /><a href="qsize.html">QSize</a> QAbstractScrollArea.minimumSizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qwidget.html#minimumSizeHint-prop">QWidget.minimumSizeHint</a>().</p>


<h3 class="fn"><a name="mouseDoubleClickEvent" />QAbstractScrollArea.mouseDoubleClickEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#mouseDoubleClickEvent">QWidget.mouseDoubleClickEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive
mouse double click events for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget. The
event is passed in <i>e</i>.</p>
<p><b>See also</b> <a href="qwidget.html#mouseDoubleClickEvent">QWidget.mouseDoubleClickEvent</a>().</p>


<h3 class="fn"><a name="mouseMoveEvent" />QAbstractScrollArea.mouseMoveEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#mouseMoveEvent">QWidget.mouseMoveEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive
mouse move events for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget. The
event is passed in <i>e</i>.</p>
<p><b>See also</b> <a href="qwidget.html#mouseMoveEvent">QWidget.mouseMoveEvent</a>().</p>


<h3 class="fn"><a name="mousePressEvent" />QAbstractScrollArea.mousePressEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#mousePressEvent">QWidget.mousePressEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive
mouse press events for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget. The
event is passed in <i>e</i>.</p>
<p><b>See also</b> <a href="qwidget.html#mousePressEvent">QWidget.mousePressEvent</a>().</p>


<h3 class="fn"><a name="mouseReleaseEvent" />QAbstractScrollArea.mouseReleaseEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#mouseReleaseEvent">QWidget.mouseReleaseEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive
mouse release events for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget. The
event is passed in <i>e</i>.</p>
<p><b>See also</b> <a href="qwidget.html#mouseReleaseEvent">QWidget.mouseReleaseEvent</a>().</p>


<h3 class="fn"><a name="paintEvent" />QAbstractScrollArea.paintEvent (<i>self</i>, <a href="qpaintevent.html">QPaintEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive
paint events (passed in <i>event</i>), for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget.</p>
<p><b>Note:</b> If you open a painter, make sure to open it on the
<a href="qabstractscrollarea.html#viewport">viewport</a>().</p>
<p><b>See also</b> <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>().</p>


<h3 class="fn"><a name="resizeEvent" />QAbstractScrollArea.resizeEvent (<i>self</i>, <a href="qresizeevent.html">QResizeEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#resizeEvent">QWidget.resizeEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive
resize events (passed in <i>event</i>), for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget.</p>
<p>When resizeEvent() is called, the viewport already has its new
geometry: Its new size is accessible through the <a href="qresizeevent.html#size">QResizeEvent.size</a>() function, and the
old size through <a href="qresizeevent.html#oldSize">QResizeEvent.oldSize</a>().</p>
<p><b>See also</b> <a href="qwidget.html#resizeEvent">QWidget.resizeEvent</a>().</p>


<h3 class="fn"><a name="scrollBarWidgets" />list-of-QWidget QAbstractScrollArea.scrollBarWidgets (<i>self</i>, <a href="qt-alignment.html">Qt.Alignment</a>&#160;<i>alignment</i>)</h3><p>Returns a list of the currently set scroll bar widgets.
<i>alignment</i> can be any combination of the four location
flags.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qabstractscrollarea.html#addScrollBarWidget">addScrollBarWidget</a>().</p>


<h3 class="fn"><a name="scrollContentsBy" />QAbstractScrollArea.scrollContentsBy (<i>self</i>, int&#160;<i>dx</i>, int&#160;<i>dy</i>)</h3><p>This virtual handler is called when the scroll bars are moved by
<i>dx</i>, <i>dy</i>, and consequently the viewport's contents
should be scrolled accordingly.</p>
<p>The default implementation simply calls <a href="qwidget.html#update">update</a>() on the entire <a href="qabstractscrollarea.html#viewport">viewport</a>(), subclasses can
reimplement this handler for optimization purposes, or - like
<a href="qscrollarea.html">QScrollArea</a> - to move a contents
widget. The parameters <i>dx</i> and <i>dy</i> are there for
convenience, so that the class knows how much should be scrolled
(useful e.g. when doing pixel-shifts). You may just as well ignore
these values and scroll directly to the position the scroll bars
indicate.</p>
<p>Calling this function in order to scroll programmatically is an
error, use the scroll bars instead (e.g. by calling <a href="qabstractslider.html#value-prop">QScrollBar.setValue</a>()
directly).</p>


<h3 class="fn"><a name="setCornerWidget" />QAbstractScrollArea.setCornerWidget (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>widget</i>)</h3><p>The <i>widget</i> argument has it's ownership transferred to Qt.</p><p>Sets the widget in the corner between the two scroll bars to be
<i>widget</i>.</p>
<p>You will probably also want to set at least one of the scroll
bar modes to <tt>AlwaysOn</tt>.</p>
<p>Passing 0 shows no widget in the corner.</p>
<p>Any previous corner widget is hidden.</p>
<p>You may call setCornerWidget() with the same widget at different
times.</p>
<p>All widgets set here will be deleted by the scroll area when it
is destroyed unless you separately reparent the widget after
setting some other corner widget (or 0).</p>
<p>Any <i>newly</i> set widget should have no current parent.</p>
<p>By default, no corner widget is present.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qabstractscrollarea.html#cornerWidget">cornerWidget</a>(),
<a href="qabstractscrollarea.html#horizontalScrollBarPolicy-prop">horizontalScrollBarPolicy</a>,
and <a href="qabstractscrollarea.html#horizontalScrollBarPolicy-prop">horizontalScrollBarPolicy</a>.</p>


<h3 class="fn"><a name="setHorizontalScrollBar" />QAbstractScrollArea.setHorizontalScrollBar (<i>self</i>, <a href="qscrollbar.html">QScrollBar</a>&#160;<i>scrollbar</i>)</h3><p>The <i>scrollbar</i> argument has it's ownership transferred to Qt.</p><p>Replaces the existing horizontal scroll bar with
<i>scrollBar</i>, and sets all the former scroll bar's slider
properties on the new scroll bar. The former scroll bar is then
deleted.</p>
<p><a href="qabstractscrollarea.html">QAbstractScrollArea</a>
already provides horizontal and vertical scroll bars by default.
You can call this function to replace the default horizontal scroll
bar with your own custom scroll bar.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qabstractscrollarea.html#horizontalScrollBar">horizontalScrollBar</a>()
and <a href="qabstractscrollarea.html#setVerticalScrollBar">setVerticalScrollBar</a>().</p>


<h3 class="fn"><a name="setHorizontalScrollBarPolicy" />QAbstractScrollArea.setHorizontalScrollBarPolicy (<i>self</i>, <a href="qt.html#ScrollBarPolicy-enum">Qt.ScrollBarPolicy</a>)</h3><h3 class="fn"><a name="setupViewport" />QAbstractScrollArea.setupViewport (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>viewport</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setupViewport(QWidget *)</tt>.</p><p>This slot is called by <a href="qabstractscrollarea.html">QAbstractScrollArea</a> after
setViewport(<i>viewport</i>) has been called. Reimplement this
function in a subclass of <a href="qabstractscrollarea.html">QAbstractScrollArea</a> to initialize
the new <i>viewport</i> before it is used.</p>
<p><b>See also</b> <a href="qabstractscrollarea.html#setViewport">setViewport</a>().</p>


<h3 class="fn"><a name="setVerticalScrollBar" />QAbstractScrollArea.setVerticalScrollBar (<i>self</i>, <a href="qscrollbar.html">QScrollBar</a>&#160;<i>scrollbar</i>)</h3><p>The <i>scrollbar</i> argument has it's ownership transferred to Qt.</p><p>Replaces the existing vertical scroll bar with <i>scrollBar</i>,
and sets all the former scroll bar's slider properties on the new
scroll bar. The former scroll bar is then deleted.</p>
<p><a href="qabstractscrollarea.html">QAbstractScrollArea</a>
already provides vertical and horizontal scroll bars by default.
You can call this function to replace the default vertical scroll
bar with your own custom scroll bar.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qabstractscrollarea.html#verticalScrollBar">verticalScrollBar</a>()
and <a href="qabstractscrollarea.html#setHorizontalScrollBar">setHorizontalScrollBar</a>().</p>


<h3 class="fn"><a name="setVerticalScrollBarPolicy" />QAbstractScrollArea.setVerticalScrollBarPolicy (<i>self</i>, <a href="qt.html#ScrollBarPolicy-enum">Qt.ScrollBarPolicy</a>)</h3><h3 class="fn"><a name="setViewport" />QAbstractScrollArea.setViewport (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>widget</i>)</h3><p>The <i>widget</i> argument has it's ownership transferred to Qt.</p><p>Sets the viewport to be the given <i>widget</i>. The <a href="qabstractscrollarea.html">QAbstractScrollArea</a> will take
ownership of the given <i>widget</i>.</p>
<p>If <i>widget</i> is 0, <a href="qabstractscrollarea.html">QAbstractScrollArea</a> will assign a
new <a href="qwidget.html">QWidget</a> instance for the
viewport.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qabstractscrollarea.html#viewport">viewport</a>().</p>


<h3 class="fn"><a name="setViewportMargins" />QAbstractScrollArea.setViewportMargins (<i>self</i>, int&#160;<i>left</i>, int&#160;<i>top</i>, int&#160;<i>right</i>, int&#160;<i>bottom</i>)</h3><p>Sets the margins around the scrolling area to <i>left</i>,
<i>top</i>, <i>right</i> and <i>bottom</i>. This is useful for
applications such as spreadsheets with "locked" rows and columns.
The marginal space is is left blank; put widgets in the unused
area.</p>
<p>Note that this function is frequently called by <a href="qtreeview.html">QTreeView</a> and <a href="qtableview.html">QTableView</a>, so margins must be implemented by
<a href="qabstractscrollarea.html">QAbstractScrollArea</a>
subclasses. Also, if the subclasses are to be used in item views,
they should not call this function.</p>
<p>By default all margins are zero.</p>


<h3 class="fn"><a name="setViewportMargins-2" />QAbstractScrollArea.setViewportMargins (<i>self</i>, <a href="qmargins.html">QMargins</a>&#160;<i>margins</i>)</h3><p>Sets <i>margins</i> around the scrolling area. This is useful
for applications such as spreadsheets with "locked" rows and
columns. The marginal space is is left blank; put widgets in the
unused area.</p>
<p>By default all margins are zero.</p>
<p>This function was introduced in Qt 4.6.</p>


<h3 class="fn"><a name="sizeHint" /><a href="qsize.html">QSize</a> QAbstractScrollArea.sizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qwidget.html#sizeHint-prop">QWidget.sizeHint</a>().</p>


<h3 class="fn"><a name="verticalScrollBar" /><a href="qscrollbar.html">QScrollBar</a> QAbstractScrollArea.verticalScrollBar (<i>self</i>)</h3><p>Returns the vertical scroll bar.</p>
<p><b>See also</b> <a href="qabstractscrollarea.html#setVerticalScrollBar">setVerticalScrollBar</a>(),
<a href="qabstractscrollarea.html#verticalScrollBarPolicy-prop">verticalScrollBarPolicy</a>,
and <a href="qabstractscrollarea.html#horizontalScrollBar">horizontalScrollBar</a>().</p>


<h3 class="fn"><a name="verticalScrollBarPolicy" /><a href="qt.html#ScrollBarPolicy-enum">Qt.ScrollBarPolicy</a> QAbstractScrollArea.verticalScrollBarPolicy (<i>self</i>)</h3><h3 class="fn"><a name="viewport" /><a href="qwidget.html">QWidget</a> QAbstractScrollArea.viewport (<i>self</i>)</h3><p>Returns the viewport widget.</p>
<p>Use the <a href="qscrollarea.html#widget">QScrollArea.widget</a>() function to
retrieve the contents of the viewport widget.</p>
<p><b>See also</b> <a href="qabstractscrollarea.html#setViewport">setViewport</a>() and
<a href="qscrollarea.html#widget">QScrollArea.widget</a>().</p>


<h3 class="fn"><a name="viewportEvent" />bool QAbstractScrollArea.viewportEvent (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>The main event handler for the scrolling area (the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget). It
handles the <i>event</i> specified, and can be called by subclasses
to provide reasonable default behavior.</p>
<p>Returns true to indicate to the event system that the event has
been handled, and needs no further processing; otherwise returns
false to indicate that the event should be propagated further.</p>
<p>You can reimplement this function in a subclass, but we
recommend using one of the specialized event handlers instead.</p>
<p>Specialized handlers for viewport events are: <a href="qabstractscrollarea.html#paintEvent">paintEvent</a>(), <a href="qabstractscrollarea.html#mousePressEvent">mousePressEvent</a>(),
<a href="qabstractscrollarea.html#mouseReleaseEvent">mouseReleaseEvent</a>(),
<a href="qabstractscrollarea.html#mouseDoubleClickEvent">mouseDoubleClickEvent</a>(),
<a href="qabstractscrollarea.html#mouseMoveEvent">mouseMoveEvent</a>(),
<a href="qabstractscrollarea.html#wheelEvent">wheelEvent</a>(),
<a href="qabstractscrollarea.html#dragEnterEvent">dragEnterEvent</a>(),
<a href="qabstractscrollarea.html#dragMoveEvent">dragMoveEvent</a>(),
<a href="qabstractscrollarea.html#dragLeaveEvent">dragLeaveEvent</a>(),
<a href="qabstractscrollarea.html#dropEvent">dropEvent</a>(),
<a href="qabstractscrollarea.html#contextMenuEvent">contextMenuEvent</a>(),
and <a href="qabstractscrollarea.html#resizeEvent">resizeEvent</a>().</p>


<h3 class="fn"><a name="wheelEvent" />QAbstractScrollArea.wheelEvent (<i>self</i>, <a href="qwheelevent.html">QWheelEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#wheelEvent">QWidget.wheelEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive
wheel events for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget. The
event is passed in <i>e</i>.</p>
<p><b>See also</b> <a href="qwidget.html#wheelEvent">QWidget.wheelEvent</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>